package com.qhg.saas_server.controller;

import com.github.pagehelper.PageInfo;
import com.qhg.saas_server.empty.Result;
import com.qhg.saas_server.pojo.Storetype;
import com.qhg.saas_server.service.impl.StoretypeServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@CrossOrigin
@RestController
@RequestMapping("/Storetype")
public class StoretypeController {

    @Autowired
    StoretypeServiceImpl storetypeService;

    /*查询门店类型*/
    @PostMapping("/SelectAll")
    public Result SelectAll(Integer pageNum,Integer pageSize){
        PageInfo pageInfo = storetypeService.SelectAll(pageNum, pageSize);
        return Result.success(pageInfo);
    }
    /*通过ID查询门店类型*/
    @GetMapping("/SelectById")
    public Result SelectById(Integer storeTypeId){
        Storetype storetype = storetypeService.SelectById(storeTypeId);
        return Result.success(storetype);
    }
    /*插入门店类型*/
    @PostMapping("/InsertStoretype")
    public Result InsertStoretype(Storetype storetype){
        storetypeService.InsertStoretype(storetype);
        return Result.buildSuccess();
    }
    /*修改门店类型信息*/
    @PostMapping("/UpdateStoretypeById")
    public Result UpdateStoretypeById(Storetype storetype){
        storetypeService.UpdateStoretypeById(storetype);
        return Result.buildSuccess();
    }
    /*通过ID删除门店类型信息*/
    @GetMapping("/DeleteById")
    public Result DeleteById(Integer storeTypeId){
        storetypeService.DeleteById(storeTypeId);
        return Result.buildSuccess();
    }

}
